package cn.rdq.iknesssystem.controller;

import cn.rdq.api.po.Carousel;
import cn.rdq.common.CommonResult;
import cn.rdq.iknesssystem.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/carousel")
public class CarouselController {

    @Autowired
    private CarouselService carouselService;

    @GetMapping("/list")
    public CommonResult list() {
        List<Carousel> carousels = carouselService.list();
        return CommonResult.successObj(carousels);
    }

    @PostMapping("/update")
    public CommonResult update(@RequestBody Carousel carousel) {
        carouselService.updateById(carousel);
        return CommonResult.success();
    }

}
